@model Orchard.ContentTypes.ViewModels.AddPartsViewModel
@{
    Style.Require("ContentTypesAdmin");
    Layout.Title = T("Add Parts To \"{0}\"", Model.Type.DisplayName).ToString();
}
@T("Choose the Parts to add to this Content Type. Adding the <b>Containable</b> part makes it possible to add content items of this type to a <b>List</b>.")
@using (Html.BeginFormAntiForgeryPost()) {
    @Html.ValidationSummary()
    <fieldset>
        @Html.UnorderedList(
            Model.PartSelections,
            (partSelection, i) => {
                var fieldNameStart = "PartSelections[" + i + "].";
                return MvcHtmlString.Create(
                    string.Format(
                        "{0} <label for=\"{1}\" class=\"forcheckbox\">{2}</label>{3}",
                        Html.CheckBox(fieldNameStart + "IsSelected"),
                        ViewData.TemplateInfo.GetFullHtmlFieldId(fieldNameStart + "IsSelected"),
                        partSelection.PartDisplayName,
                        Html.Hidden(fieldNameStart + "PartName", partSelection.PartName)));
                  
            },
            "available-parts")
    </fieldset>
    <fieldset>
        <button class="primaryAction" type="submit">@T("Save")</button>
    </fieldset>
}